-- Require the event module
local Event = require('__stdlib__/stdlib/event/event')
local table = require('__stdlib__/stdlib/utils/table')
local Game = require('__stdlib__/stdlib/game')

-- Register our hotkeys

-- Pressing the fist hotkey will run both functions
-- Event.register("stdlib-test-hotkey-1", function() game.print("Test key 1 #2") end)

-- Pressing the second hotkey will just run this function
-- Event.register("stdlib-test-hotkey-2", function() game.print("Test key 2") end)

-- Anytime we build something lets run this function
--创建一个新建筑的时候发生的事件
Event.register(defines.events.on_built_entity, function(event)
	local runtimetype = event.created_entity.type
	local runtimename = event.created_entity.name
	--获取新建建筑的type跟name
	--game.print("用户创建了一个名字为" .. runtimename .."  的实体,类型: " .. runtimetype)
	--不能在运行时修改创建建筑的属性
	--data.raw[event.created_entity.type][event.created_entity.name].crafting_speed = 1000
	-- game.print( "将用户创建的实体的表用深拷贝到自定义的属性上做修改" )

	-- local copy = table.full_copy(data.raw[runtimetype][runtimename])
end)
--定时器
-- Event.register(defines.events.on_tick, function(event) game.print(event.tick) end)